<template>
	<view class="result-pages">
		<template v-if="status==1">
			<image :src="imgStorage+'/login/success.png'" class="result-img"></image>
			<view class="title">匹配成功</view>
			<view class="text">已为您匹配到房屋，请进行人脸识别认证</view>
			<view class="result-item">
				<view class="result-title">匹配结果：</view>
				<image :src="imgStorage+'/login/lianzu.png'" class="result-icon"
					v-if="info.list[0].houseType.includes('廉租')">
				</image>
				<image :src="imgStorage+'/login/gongzu.png'" class="result-icon"
					v-else-if="info.list[0].houseType.includes('公租')">
				</image>
				<image :src="imgStorage+'/login/zhiguan.png'" class="result-icon"
					v-else-if="info.list[0].houseType.includes('直管')">
				</image>
				<view class="result-text">
					{{info.list[0].areaName||''}}{{info.list[0].streetName||''}}{{info.list[0].buildingNumber||''}}#{{info.list[0].unitNumber||''}}-{{info.list[0].floorLevel||''}}0{{info.list[0].roomNumber||''}}
				</view>
			</view>
			<view class="btn normal" @click="certificate">人脸识别</view>
		</template>
		<template v-if="status==2">
			<image :src="imgStorage+'/login/error.png'" class="result-img"></image>
			<view class="title">未匹配到住房信息</view>
			<view class="text">请拨打{{info.yydh}}联系管理员添加住房</view>
			<view class="btn-item">
				<view class="btn1 cancel" @click="switchTab">取消</view>
				<view class="btn1 normal " @click="call(info.yydh)">
					<view class="iconfont icon-a-boda2"></view>拨打电话
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import {
		getStorage
	} from '../../util/auth'
	import {
		getFaceResultByVerifyResult
	} from '@/api/authentication.js'
	export default {
		data() {
			return {
				status: 2,
				info: {
					list: [],
					yydh: ''
				},
				form: {}
			}
		},
		methods: {
			certificate() {
				// wx.startFacialRecognitionVerify({
				// 	name: this.form.userName,
				// 	idCardNumber: this.form.idCard,
				// 	success: (e) => {
				// 		if (e.errCode == 0) {
				// 			uni.showLoading({
				// 				title: '认证中',
				// 				mask: true
				// 			})
				// 			getFaceResultByVerifyResult({
				// 				verifyResult: e.verifyResult
				// 			}).then(res => {
				this.showToast('认证成功', () => {
					uni.reLaunch({
						url: '/page_pack/authentication/bind_phone?id=' +
							this.info.list[0].id
					})
				}, 1000)
				// 			})
				// 		} else {
				// 			this.showToast('认证失败')
				// 		}
				// 	},
				// 	fail: (e) => {
				// 		this.showToast('认证失败')
				// 	}
				// })
			}
		},
		onLoad(e) {
			this.status = e.type
			if (getStorage('houseInfo')) {
				this.info = getStorage('houseInfo');
			}
			if (getStorage('formInfo')) {
				this.form = getStorage('formInfo');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.result-pages {
		height: 90vh;
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 30rpx;

		.result-img {
			width: 260rpx;
			height: 260rpx;
		}

		.title {
			font-size: 34rpx;
			font-weight: bold;
			margin-top: 40rpx;
		}

		.text {
			font-size: 30rpx;
			margin-top: 40rpx;
		}

		.result-item {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-top: 40rpx;

			.result-title {
				width: 160rpx;
				font-size: 30rpx;
			}

			.result-icon {
				width: 42rpx;
				height: 42rpx;
				margin-right: 6rpx;
			}

			.result-text {
				font-weight: bold;
				font-size: 32rpx;
			}
		}

		.btn {
			width: 100%;
			border-radius: 20rpx;
			height: 90rpx;
			margin-top: 150rpx;
		}

		.btn-item {
			margin-top: 100rpx;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.btn1 {
				width: 330rpx;
				height: 90rpx;
				font-size: 32rpx;
				border-radius: 10px;
				display: flex;
				align-items: center;
				justify-content: center;

				.iconfont {
					margin-right: 20rpx;
					font-size: 34rpx;
				}
			}
		}
	}
</style>